#include<iostream>
using namespace std;
int isBD(char c){
	if(c==',') return 1;
	if(c=='.')	return 1;
	if(c==' ') return 1;
	if(c=='?')	return 1;
	if(c=='!')	return 1;
	return 0;
} 

int main(){
	int i=0;
	char s[100];
	cin.get(s,100);
	while(s[i]!='\0'){
		while(isBD(s[i])==1&&s[i]!=0){
			cout<<s[i];					
			i++;
		}
		int start = i;
		while(isBD(s[i])==0&&s[i]!=0){
			i++;
		}
		int end = i-1;
		int j=start,k=end;
		while(j<k){						
			char t = s[k];
			s[k]=s[j];
			s[j]=t;
			j++;
			k--;
		}
		for(int l=start;l<=end;l++){		
			cout<<s[l];
		}
	}
	return 0;
}
